package cn.lili.modules.distribution.entity.vos;

import cn.hutool.core.text.CharSequenceUtil;
import cn.lili.common.vo.PageVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;

/**
 * 分销佣金查询信息
 *
 * @author pikachu
 * @since 2020-03-26 09:04:53
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class DistributionCashSearchParams extends PageVO {

    @Serial
    private static final long serialVersionUID = 6740097004456090796L;

    /**
     * 编号
     */
    @ApiModelProperty(value = "编号")
    private String sn;

    @ApiModelProperty(value = "分销员id")
    private String distributionId;

    /**
     * 会员名称
     */
    @ApiModelProperty(value = "会员名称")
    private String memberName;

    /**
     * 分销员提现状态
     */
    @ApiModelProperty(value = "分销员提现状态", allowableValues = "APPLY,PASS,REFUSE")
    private String distributionCashStatus;

    public <T> QueryWrapper<T> queryWrapper() {
        QueryWrapper<T> queryWrapper = new QueryWrapper<>();
        if (CharSequenceUtil.isNotEmpty(memberName)) {
            queryWrapper.like("distribution_name", memberName);
        }
        if (CharSequenceUtil.isNotEmpty(sn)) {
            queryWrapper.like("sn", sn);
        }
        if (CharSequenceUtil.isNotEmpty(distributionCashStatus)) {
            queryWrapper.like("distribution_cash_status", distributionCashStatus);
        }
        if (CharSequenceUtil.isNotEmpty(distributionId)) {
            queryWrapper.like("distribution_id", distributionId);
        }
        return queryWrapper;
    }

}
